package com.gopay.common.domain.cps.transfer;

import com.gopay.common.constants.approval.DecisionValue;
import com.gopay.common.domain.acps.Drcr;
import com.gopay.common.domain.adjust.ManualAdjustAcctDtl;
import com.gopay.common.domain.adjust.ManualAdjustMain;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Administrator on 14-3-6.
 */
public class Tran09800VO implements Serializable{

    /**
     * 1：发起调账申请 2：审批调账 3：审核确认 4：撤销 5:校验
     */
    private int opType;

    private String operId;

    /**
     * 审批结果 DecisionValue
     */
    private DecisionValue decision;

    /**
     * 审批描述
     */
    private String decisionMsg;

    private String gopayOrderId;

    private String amtLimit;

    private List<ManualAdjustAcctDtl> manualAdjustAcctDtlList;
    private ManualAdjustMain manualAdjustMain;

    public int getOpType() {
        return opType;
    }

    public void setOpType(int opType) {
        this.opType = opType;
    }

    public DecisionValue getDecision() {
        return decision;
    }

    public void setDecision(DecisionValue decision) {
        this.decision = decision;
    }

    public String getDecisionMsg() {
        return decisionMsg;
    }

    public void setDecisionMsg(String decisionMsg) {
        this.decisionMsg = decisionMsg;
    }

    public List<ManualAdjustAcctDtl> getManualAdjustAcctDtlList() {
        return manualAdjustAcctDtlList;
    }

    public void setManualAdjustAcctDtlList(List<ManualAdjustAcctDtl> manualAdjustAcctDtlList) {
        this.manualAdjustAcctDtlList = manualAdjustAcctDtlList;
    }

    public ManualAdjustMain getManualAdjustMain() {
        return manualAdjustMain;
    }

    public void setManualAdjustMain(ManualAdjustMain manualAdjustMain) {
        this.manualAdjustMain = manualAdjustMain;
    }

    public String getGopayOrderId() {
        return gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    public String getAmtLimit() {
        if(StringUtils.isBlank(amtLimit)) {
            return "100000";
        }
        return amtLimit;
    }

    public void setAmtLimit(String amtLimit) {
        this.amtLimit = amtLimit;
    }

    public BigDecimal getCrTranAmt(){
        BigDecimal CSumAmt = new BigDecimal(0);
        if(manualAdjustAcctDtlList!=null && manualAdjustAcctDtlList.size()>0){
            for(ManualAdjustAcctDtl adjustAcctDtl : manualAdjustAcctDtlList){
                if(StringUtils.equals(Drcr.C.name(), adjustAcctDtl.getDrCr())){
                    CSumAmt = CSumAmt.add(adjustAcctDtl.getTranAmt());
                }
            }
        }
        return CSumAmt;
    }

    public BigDecimal getDrTranAmt(){
        BigDecimal DSumAmt = new BigDecimal(0);
        if(manualAdjustAcctDtlList!=null && manualAdjustAcctDtlList.size()>0){
            for(ManualAdjustAcctDtl adjustAcctDtl : manualAdjustAcctDtlList){
                if(StringUtils.equals(Drcr.D.name(), adjustAcctDtl.getDrCr())){
                    DSumAmt = DSumAmt.add(adjustAcctDtl.getTranAmt());
                }
            }
        }
        return DSumAmt;
    }

    public String getOperId() {
        return operId;
    }

    public void setOperId(String operId) {
        this.operId = operId;
    }
}
